package com.qiangesoft.blog.file.service;

import java.io.InputStream;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.IService;
import com.qiangesoft.blog.file.entity.SysFileInfo;
import com.qiangesoft.blog.file.model.FileInfoVo;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 文件存储信息Service接口
 *
 * @author qiange
 * @date 2023-04-26
 */
public interface ISysFileInfoService extends IService<SysFileInfo> {

    /**
     * 上传文件
     *
     * @param file
     * @return
     */
    FileInfoVo uploadFile(MultipartFile file) throws Exception;

    /**
     * 上传文件
     *
     * @param file
     * @return
     */
    FileInfoVo uploadFileByPath(MultipartFile file, String path) throws Exception;

    /**
     * 上传文件
     *
     * @param inputStream
     * @param contentType
     * @return
     * @throws Exception
     */
    FileInfoVo uploadFile(InputStream inputStream, String contentType) throws Exception;

    /**
     * 上传文件
     *
     * @param inputStream
     * @param contentType
     * @param path
     * @return
     * @throws Exception
     */
    FileInfoVo uploadFileByPath(InputStream inputStream, String contentType, String path) throws Exception;

    /**
     * 批量上传文件
     *
     * @param files
     * @return
     */
    List<FileInfoVo> batchUploadFile(MultipartFile[] files) throws Exception;

    /**
     * 下载文件
     *
     * @param fileId
     * @return
     */
    void download(Long fileId, HttpServletRequest request, HttpServletResponse response) throws Exception;

    /**
     * 文件详情
     *
     * @param fileId
     */
    FileInfoVo getFileInfoById(Long fileId);

    /**
     * 批量查询
     *
     * @param fileIds
     * @return
     */
    List<FileInfoVo> getFileInfoByIds(List<Long> fileIds);
}
